package com.Txunda.fxw.ui.http;

import com.Txunda.fxw.base.web.ApiListener;
import com.Txunda.fxw.base.web.ApiTool;
import com.Txunda.fxw.ui.toolkit.config.Config;
import com.lidroid.xutils.http.RequestParams;

import java.io.File;

public class FeedBack {

    public void addFeedback(String content, String m_id, String type, File head_pic, String nickname, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addBodyParameter("content", content);
        params.addBodyParameter("m_id", m_id);
        params.addBodyParameter("type", type);
        if (head_pic != null && head_pic.exists())
            params.addBodyParameter("head_pic", head_pic);
        params.addBodyParameter("nickname", nickname);
        apiTool.postApi(Config.BASE_URL + "Feedback/addFeedback", params, apiListener);
    }

    public void feedbackList(int p, String type, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addQueryStringParameter("p", String.valueOf(p));
        params.addQueryStringParameter("type", type);
        apiTool.postApi(Config.BASE_URL + "Feedback/FeedbackList", params, apiListener);
    }

    public void comment(String m_id, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addBodyParameter("m_id", m_id);
        apiTool.postApi(Config.BASE_URL + "Feedback/comment", params, apiListener);
    }

}
